const Koa = require('koa')
const koaBody = require('koa-body')
const cors = require('koa2-cors')
const koaBodyParser = require('koa-bodyparser')

const router = require('./routes')


const app = new Koa()


//可以返回json数据
app.use(koaBody())

//允许跨域
app.use(cors())

//就收post数据
app.use(koaBodyParser())

//配置路由
app.use(router.routes()).use(router.allowedMethods())

app.listen(3333)
